package com.designPattern.constructor;

public class Test {
    public static void main(String[] args) {
        Director director = new Director(new CommonHouseBuilder());
        House house = director.createHouse();
        System.out.println("++++++++++++++++++++++++");
        System.out.println(house);
        //在StringBuilder源码中
        /**
         * StringBuilder的创建用到了【建造者模式】
         * StringBuilder即是建造者也是指挥者
         * 初始化（修改对象）的方法是append()
         */
        StringBuilder stringBuilder = new StringBuilder("hello world");
        stringBuilder.append("nice");
        System.out.println(stringBuilder);
        /**
         * 下面这个很好的体现了建造者模式中创建对象的过程
         */
        //1.创建对象
        StringBuilder stringBuilder1 = new StringBuilder();
        //2.通过建造者中的append方法(相当于create()方法)
        stringBuilder1.append("stringBuilder1");
        System.out.println(stringBuilder1);
        Thread thread = new Thread();
        thread.start();
        thread.run();
    }
}
